#include "../logs/maglog.h"
#include <cstdlib>

void testCpuStress() {
    LOGI("开始CPU压力测试");

    // 模拟CPU高负载
    std::string command = "stress-ng --cpu 2 --timeout 60s";
    if (system(command.c_str()) != 0) {
        LOGE("CPU压力测试失败");
    }

    LOGI("CPU压力测试结束");
}

void testMemoryStress() {
    LOGI("开始内存压力测试");

    // 模拟内存压力
    std::string command = "stress-ng --vm 1 --vm-bytes 90% --timeout 60s";
    if (system(command.c_str()) != 0) {
        LOGE("内存压力测试失败");
    }

    LOGI("内存压力测试结束");
}

int main() {
    // 执行CPU压力测试
    testCpuStress();

    // 执行内存压力测试
    testMemoryStress();

    return 0;
}
